home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
JCSM Shareware Collection 1993 November
/
JCSM Shareware Collection - 1993-11.iso
/
cl720
/
sst115j.lzh
/
SSTFOS.H
< prev
next >
Wrap
C/C++ Source or Header
|
1992-05-20
|
9KB
|
174 lines
/* ------------------------------------------------------------------------ */
/* sstfoss.c */
/* */
/* Revision 5 FOSSIL interface layer */
/* CopyRight (C) 1991,1992 Steven Lutrov. All rights reserved. */
/* ------------------------------------------------------------------------ */
#define F_SIGNATURE 0x1954
#define F_SETDTR 0x0001
#define F_RESETDTR 0x0000
#define F_NULL 0xFFFF
/* ------------------------------------------------------------------------ */
/* Port Status flags */
/* ------------------------------------------------------------------------ */
#define F_RXCHARS 0x0100 /* Characters in input buffer */
#define F_RXOVER 0x0200 /* Receive buffer overrun */
#define F_MASK 0x0008 /* Bits always set */
#define F_TXCHARS 0x2000 /* Transmit buffer not full */
#define F_TXEMPTY 0x4000 /* Transmit buffer is empty */
#define F_CARRIER 0x0080 /* Carrier detect is high */
/* ------------------------------------------------------------------------ */
/* Port IDs */
/* ------------------------------------------------------------------------ */
#define F_COM1 0x0000 /* Com port 1 */
#define F_COM2 0x0001 /* Com port 2 */
#define F_COM3 0x0002 /* Com port 3 */
#define F_COM4 0x0003 /* Com port 4 */
#define F_CONSOLE 0x00FF /* Route port to console */
/* ------------------------------------------------------------------------ */
/* Baud Rates */
/* ------------------------------------------------------------------------ */
#define F_B300 0x0040 /* 300 baud */
#define F_B600 0x0060 /* 600 baud */
#define F_B1200 0x0080 /* 1200 baud */
#define F_B2400 0x00a0 /* 2400 baud */
#define F_B4800 0x00c0 /* 4800 baud */
#define F_B9600 0x00e0 /* 9600 baud */
#define F_B19200 0x0000 /* 19200 baud */
#define F_B38400 0x0020 /* 38400 baud */
#define F_B57600 0x0100 /* 57600 baud */
#define F_B115200 0x0120 /* 115200 baud */
#define F_BMASK 0x01E0 /* Mask for baud rate */
/* ------------------------------------------------------------------------ */
/* Character Framing */
/* ------------------------------------------------------------------------ */
#define F_PMASK 0x0018 /* Mask for parity bits */
#define F_NOPARITY 0x0000 /* No parity */
#define F_SPCPARITY 0x0010 /* Space/mark parity */
#define F_ODDPARITY 0x0008 /* Odd parity */
#define F_EVENPARITY 0x0018 /* Even parity */
#define F_SMASK 0x0004 /* Stop bits mask */
#define F_STOP1 0x0000 /* 1 stop bit */
#define F_STOP2 0x0004 /* 2 stop bits */
#define F_BITMASK 0x0003 /* Bit mask */
#define F_BITS5 0x0000 /* 5 data bits */
#define F_BITS6 0x0001 /* 6 data bits */
#define F_BITS7 0x0002 /* 7 data bits */
#define F_BITS8 0x0003 /* 8 data bits */
#define F_NORMAL (F_BITS8|F_STOP1|F_NOPARITY)
#define F_UNIX (F_BITS7|F_STOP1|F_EVENPARITY)
#define F_8N1 (F_BITS8|F_STOP1|F_NOPARITY)
#define F_8N2 (F_BITS8|F_STOP2|F_NOPARITY)
#define F_7O1 (F_BITS7|F_STOP1|F_ODDPARITY)
#define F_7E1 (F_BITS7|F_STOP1|F_EVENPARITY)
#define F_7N1 (F_BITS7|F_STOP1|F_NOPARITY)
#define F_7O2 (F_BITS7|F_STOP2|F_ODDPARITY)
#define F_7E2 (F_BITS7|F_STOP2|F_EVENPARITY)
#define F_7N2 (F_BITS7|F_STOP2|F_NOPARITY)
/* ------------------------------------------------------------------------ */
/* Flow Control flags */
/* ------------------------------------------------------------------------ */
#define F_LOCXON 0x0001 /* Enables local Xon/Xoff */
#define F_LOCCTS 0x0002 /* Enables local Cts/Dte */
#define F_REMXON 0x0008 /* Enables remove Xon/Xoff */
#define F_XONOFF 0x0000 /* Disables all flow control */
/* ------------------------------------------------------------------------ */
/* Break detect flags */
/* ------------------------------------------------------------------------ */
#define F_BRK_ON 0x0001 /* Enable ^C/^K checking */
#define F_BRK_OFF 0x0000 /* Disable ^C/^K checking */
#define F_SRELEASE 0x0002 /* Force Xoff transmitter */
/* ------------------------------------------------------------------------ */
/* FOSSIL status bits */
/* ------------------------------------------------------------------------ */
#define F_DCD (0x0080)
#define F_RDA (0x0100)
#define F_OVRN (0x0200)
#define F_THRE (0x2000)
#define F_TSRE (0x4000)
/* ------------------------------------------------------------------------ */
/* macros */
/* ------------------------------------------------------------------------ */
#define fcarrier(p) (fstatus(p) & F_CARRIER)
/* ------------------------------------------------------------------------ */
/* Fossil information structures */
/* ------------------------------------------------------------------------ */
struct finfo {
char maxfunc; /* Maximum function call supported */
char revision; /* FOSSIL revision number */
};
struct ftinfo {
char timerint; /* Timer tick interrupt number */
char ticksecs; /* Number of timer ticks per second */
char milltick; /* Number of milliseconds per timer tick */
};
struct fdata {
short fdsize; /* Offset 0 (word) = Structure size */
char specver; /* 2 (byte) = FOSSIL spec version */
char drvlvl; /* 3 (byte) = Driver rev level */
char far *drvid; /* 4 (dwrd) = Pointer to ASCII ID */
short rxsize; /* 8 (word) = Input buffer size */
short rxavail; /* 0A (word) = Bytes avail (input) */
short txsize; /* 0C (word) = Output buffer size */
short txavail; /* 0E (word) = Bytes avail (output) */
char scnwid; /* 10 (byte) = Screen width, chars */
char scnlen; /* 11 (byte) = Screen height, chars */
short bdmask; /* 12 (word) = Baud rate mask */
char filler[2];
};
/* ------------------------------------------------------------------------ */
/* Function prototypes */
/* ------------------------------------------------------------------------ */
unsigned int finit (unsigned int p, unsigned int b);
unsigned int fputch (unsigned int p, char c);
unsigned int fgetch (unsigned int p);
unsigned int fstatus (unsigned int p);
unsigned int ffinit (unsigned int p, unsigned int *f, char far *fb);
void fdeinit (unsigned int p);
void fdtr (unsigned int p, unsigned int d);
unsigned int ftickparms (unsigned int *ms);
void fflushout (unsigned int p);
void fpurgeout (unsigned int p);
void fpurgein (unsigned int p);
unsigned int fpoke (unsigned int p, char c);
unsigned int fpeek (unsigned int p);
unsigned int fkbdpeek (void);
unsigned int fkbdgetch (void);
void fflow (unsigned int p, unsigned char m);
unsigned int fcontrol (unsigned int p, unsigned char m);
void fgotoxy (unsigned int x, unsigned int y);
unsigned int fwherexy (unsigned int *x, unsigned int *y);
void fdispansi (char c);
void fwatchdog (unsigned int p, int f);
void fdispbios (char c);
unsigned int ftickchain (int a, void (far *func)());
void freboot (unsigned int w);
unsigned int fgetblk (unsigned int p, void far *buf, unsigned int z);
unsigned int fputblk (unsigned int p, void far *buf, unsigned int z);
void fbreak (unsigned int p, unsigned int f);
unsigned int finfo (unsigned int p, void far *buf, unsigned int z);
unsigned int faddapp (unsigned int p, unsigned int *c,
void (far *func)());
unsigned int fdelapp (unsigned int p, unsigned int *c,
void (far *func)());